#include <stdio.h>
#include <stdlib.h>

int main (int argc, char const* argv[])
{
    int n, c, sum, i, t, ans;

    scanf("%d", &n);
    while (n--) {
        scanf("%d", &c);
        sum = 0;
        for (i = 0; i < c; i++) {
            scanf("%d", &t);
            sum += t;
        }

        ans = sum - c + 1;
        printf("%d\n", ans);
    }

    return 0;
}
